#import "SEGQuerycustomertelexistManager.h"

#if __has_include(<Commom/SEGModel.h>)
#import <Commom/SEGModel.h>
#else
#import "SEGModel.h"
#endif
#if __has_include(<Commom/SEGHTTPBusinessManager.h>)
#import <Commom/SEGHTTPBusinessManager.h>
#else
#import "SEGHTTPBusinessManager.h"
#endif

static id _queryCustomerTelExistManager;
static dispatch_once_t onceToken;

@implementation SEGQuerycustomertelexistManager
#pragma mark - SINGLE----BEGIN----
+(instancetype)sharedManager{
dispatch_once(&onceToken, ^{
_queryCustomerTelExistManager = [[self alloc] init];
});
return _queryCustomerTelExistManager;
}

+(void)destroyResource{
onceToken = 0;
_queryCustomerTelExistManager = nil;
}

#pragma mark - SINGLE----END----

#pragma mark - HTTP----BEGIN----

/// 校验手机号是否已经绑定其他身份证号码
/// @param communityId 项目ID
/// @param custCard 证件号码
/// @param tel 手机号
/// @param custId 客户ID
-(void)requestQuerycustomertelexistWithCommunityid:(NSString*)communityId custCard:(NSString*)custCard tel:(NSString*)tel custId:(NSString*)custId finished:(void(^)(BOOL isSuccessed,id result,NSString* codeType,NSString* errorMessage))finished{

NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setValue:communityId forKey:@"communityId"];
[params setValue:custCard forKey:@"custCard"];
[params setValue:tel forKey:@"tel"];
[params setValue:custId forKey:@"custId"];

NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/uhomecp-sso/v2/userHouse/queryCustomerTelExist",nil];
[SEGHTTPBusinessManager seg_requestJSONWithMethod:POST URLString:urlString parameters:params completed:^(BOOL isSuccessed, id result, NSString *codeType, NSError *error) {
if (!isSuccessed) {
finished(isSuccessed,nil,codeType,error.localizedDescription);
return;
}

self.queryCustomerTelExist = [SEGQuerycustomertelexistModel yy_modelWithDictionary:result];
finished(isSuccessed,result,codeType,error.localizedDescription);
return;
}];
}
#pragma mark - HTTP----END----

#pragma mark - GETTER----BEGIN----
-(SEGQuerycustomertelexistModel *)queryCustomerTelExist{
if (!_queryCustomerTelExist) {
_queryCustomerTelExist = [[SEGQuerycustomertelexistModel alloc]init];
}
return _queryCustomerTelExist;
}
#pragma mark - GETTER----END----
@end
